package tests;

/**
 * Test is the class to run Black Box tests.
 * 
 * @author Team Switchboard Boxcar
 */

import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import events.*;
import gui.*;
import neighborhood.*;
import priorityQueue.*;
import road.*;
import simulation.*;
import statistics.*;
import train.*;
import traveler.*;


public class Test {
	/**
	 * This Test Constructor takes inputs for the Event class.
	 * 
	 */
	private static Simulation testSim;


    public static void main(String[] args) {
    	/*TestBasicClasses();
    	testEvents();
    	buildRoad();
    	buildQueue();
    	buildNeighborhood();
      	CreateAverageStats();
    	TestStatistics();
       	print("_______________________________________");
    	print("22. Verify that a Simulation can be Created");
    	initTestSim();
    	print("Verify the data in debugging");
    	print("_______________________________________");
    	print("25. Verify that a Simulation contains a Priority Queue");
    	
    	print("Verify the data in debugging");
    	print("27. Verify that a Simulation contains a Neighborhood");
    	print("Verify the data in debugging");
    	RunUseCases();*/
    	
    	print("_______________________________________");
    	print("26. Verify that a Simulation works with events");
      	initTestSim();
      	testSim.PlaceEvent(new Generate_Travelers(25000, 780));
      	testSim.PlaceEvent(new Train_Arrival(new Train(0, 5, 1),3,500));
      	testSim.PlaceEvent(new Car_Arrival(new Car(0,-1), 0, 2, 2, 20));
      	testSim.PlaceEvent(new Car_Accident(3, 3, 1000, false));
      	testSim.PlaceEvent(new Rain(.15));
     
     	print("_______________________________________");
    	print("28a. Verify that a Simulation contains 0 trains");
      	initTestSim();
      	testSim.SetInitialConditions(0.15, 0.6, 0, 1, new int[]{0}, new int[]{3}, new int[]{4});
    	print("28a. Check Debug");

     	print("_______________________________________");
    	print("28b. Verify that a Simulation contains 9 trains");
      	initTestSim();
      	testSim.SetInitialConditions(0.15, 0.6, 9, 1, new int[]{0}, new int[]{3}, new int[]{4});
    	print("28b. Check Debug");

    	
     	print("_______________________________________");
    	print("28c. Verify that a Simulation contains 15 trains");
      	initTestSim();
      	testSim.SetInitialConditions(0.15, 0.6, 15, 1, new int[]{0}, new int[]{3}, new int[]{4});
    	print("28c. Check Debug");

    	print("_______________________________________");
    	print("29. Neigh + Travelers");
    	initTestSim();
    	testSim.SetInitialConditions(.5, 0.85, 10, 9, new int[]{0,0,0,1,2,2,2,3,3}, new int[]{0,0,3,0,0,3,4,0,3}, new int[]{10,10,50,33,89,11,52,90,39});
    	print("SetInitialConditions:\rNo chance for rain\r30% of total traffic (24,000x5)\r0 trains\r0 accidents\r_______");
    	print("29. Check Debug for 0 travelers on trains");
    	testSim.ProcessEvents();
    	print("29. Check Debug for travelers on trains");
      	
    	
    }

    // function to build most basic elements
    private static void TestBasicClasses()
    {/*
    	print("_______________________________________");
    	print("Testing Implementation Plan");
    	
    	
    	print("_______________________________________");
    	print("1. Verify that an Event can be Created");
    	print("\rEvent Class:\r   Creating Event with an EventID of 5 and Time of -1.");
    	Event testEvent1a = new Event(5,-1);
    	print("   Created Event has an EventID of " + testEvent1a.GetEffect() + " and Time of " + testEvent1a.GetTime());
    	print("\rEvent Class:\r   Creating Event with an EventID of 9999 and Time of 9999.");
    	Event testEvent1b = new Event(9999,9999);
    	print("   Created Event has an EventID of " + testEvent1b.GetEffect() + " and Time of " + testEvent1b.GetTime());
    	
    	
    	print("_______________________________________");
    	print("2. Verify that a Prioity Queue can be Created");
    	PriorityQueue pQueue = new PriorityQueue();    
    	print("Priority Queue pQueue Created");
    	
    	print("_______________________________________");
    	print("3. Verify that the Prioity Queue works with the Event Class");
    	print("\rPriority Queue Class:\r   Creating Priority Queue and adding Events with Times (in order) 50,179,-1");
    	pQueue.enqueue(new Event(2,-1));
    	pQueue.enqueue(new Event(0,50));
    	pQueue.enqueue(new Event(1,179));
    	pQueue.enqueue(new Event(5,-5));
    	pQueue.enqueue(new Event(2,34));
    	pQueue.enqueue(new Event(2,67));
    	pQueue.enqueue(new Event(2,200));
    	pQueue.dequeue();
    	pQueue.dequeue();
    	pQueue.dequeue();
    	pQueue.dequeue();
    	pQueue.dequeue();
    	pQueue.dequeue();
    	//print("   Dequeueing Events:\r      First Event has Time " + pQueue.dequeue().GetTime() + "\r      Second Event has Time " + pQueue.dequeue().GetTime() + "\r      Third Event has Time " + pQueue.dequeue().GetTime());

    	
    	print("_______________________________________");
    	print("4. Verify that a Traveler can be created"); 	
    	print("\rTraveler Class:\r   Creating Traveler with departure time 3 and destination 0");
    	Traveler testTrav4a = new Traveler(0,3);
    	print("   Created Traveler has departure time " + testTrav4a.GetTotalTime() + " and destination " + testTrav4a.GetDestination());
    	print("\rTraveler Class:\r   Creating Traveler with departure time 179 and destination 1");
    	Traveler testTrav4b = new Traveler(1,179);
    	print("   Created Traveler has departure time " + testTrav4b.GetTotalTime() + " and destination " + testTrav4b.GetDestination());
    	print("\rTraveler Class:\r   Creating Traveler with departure time -1 and destination 5");
    	Traveler testTrav4c = new Traveler(5,-1);
    	print("   Created Traveler has departure time " + testTrav4c.GetTotalTime() + " and destination " + testTrav4c.GetDestination());
  
    
    	
    	
    	print("_______________________________________");
    	print("5. Verify that a Car can be created"); 
    	print("\rCar Class:\r   Creating Traveler with departure time 0 and destination 3");
    	Car testCar5a = new Car(3,0);
    	print("   Created Car has departure time " + testCar5a.GetTotalTime() + " and destination " + testCar5a.GetDestination());
    	print("\rCar Class:\r   Creating Traveler with departure time -1 and destination 0");
    	Car testCar5b = new Car(0,-1);
    	print("   Created Car has departure time " + testCar5b.GetTotalTime() + " and destination " + testCar5b.GetDestination());
    	print("\rCar Class:\r   Creating Traveler with departure time 500 and destination 2");
    	Car testCar5c = new Car(2,500);
    	print("   Created Car has departure time " + testCar5c.GetTotalTime() + " and destination " + testCar5c.GetDestination());

    	
    	
    	print("_______________________________________");
    	print("6. Verify that a Train can be created"); 
    	print("\rTrain Class:\r   Creating Train with departure time 650, direction CCW, maximum passengers 100.");
    	Train testTrain6a = new Train(650, 100, -1);
      	print("   Created Train has departure time " + testTrain6a.returnDepartTime() + " and direction " + testTrain6a.returnDirection());
    	print("\rTrain Class:\r   Creating Train with departure time 0, direction CW, maximum passengers 5.");
    	Train testTrain6b = new Train(0, 5, 1);
      	print("   Created Train has departure time " + testTrain6b.returnDepartTime() + " and direction " + testTrain6b.returnDirection());
    	
    	
    	print("\rTrain Class:\r   Creating Train with departure time 1, direction CCW, maximum passengers 100, adding 3 travelers to UC list, 1 traveler to Industrial list, 0 travelers to Downtown list, 2 travelers to LC list.");
    	if (!testTrain6b.isTrainFull())
			testTrain6b.AddPassenger(new Traveler(0, 0));
		if (!testTrain6b.isTrainFull())
			testTrain6b.AddPassenger(new Traveler(0, 0));
		if (!testTrain6b.isTrainFull())
			testTrain6b.AddPassenger(new Traveler(0, 0));
		if (!testTrain6b.isTrainFull())
			testTrain6b.AddPassenger(new Traveler(1, 0));
		if (!testTrain6b.isTrainFull())
			testTrain6b.AddPassenger(new Traveler(3, 0));
		if (!testTrain6b.isTrainFull())
			testTrain6b.AddPassenger(new Traveler(3, 0));
       	print("      Number of passengers in UC List: " + testTrain6b.UnloadPassengers(0).size());
    	print("      Number of passengers in Industrial List: " + testTrain6b.UnloadPassengers(1).size());
    	print("      Number of passengers in Downtown List: " + testTrain6b.UnloadPassengers(2).size());
    	print("      Number of passengers in LC List: " + testTrain6b.UnloadPassengers(3).size());

    	
    	if(true);*/
    }
    
    // function to build events
    private static void testEvents()
    {/*
    	print("_______________________________________");
    	print("8. Verify that a Generate_Traveler can be created"); 
    	print("\rGenerate_Travelers Class:\r   Creating Generate_Travelers with occurence time -1, 1000000 people to be generated.");
    	Generate_Travelers trav8a = new Generate_Travelers(1000000, -1);
    	print("   Created Generate_Travelers has occurence time " + trav8a.GetTime() + " and travelers " + trav8a.AddTravelers());
     	print("\rGenerate_Travelers Class:\r   Creating Generate_Travelers with occurence time 780, 25000 people to be generated.");
    	Generate_Travelers trav8b = new Generate_Travelers(25000, 780);
    	print("   Created Generate_Travelers has occurence time " + trav8b.GetTime() + " and travelers " + trav8b.AddTravelers());
    	    	
    	print("_______________________________________");
    	print("9. Verify that a Train_Arrival can be created"); 
    	print("\rTrain_Arrival Class:\r   Creating Train_Arrival with occurence time -1, destination 0 and train from 6a.");
    	Train_Arrival train9a = new Train_Arrival(new Train(650, 100, -1),-1,0);
    	print("   Created Train_Arrival has occurence time " + train9a.GetTime()+ ", destination " + train9a.GetDestination() + ", train settings: " + train9a.GetTrain().returnDirection() + "/" + train9a.GetTrain().returnDepartTime() );
    	print("\rTrain_Arrival Class:\r   Creating Train_Arrival with occurence time 5005, destination 3 and train from 6b.");
    	Train_Arrival train9b = new Train_Arrival(new Train(0, 5, 1),3,500);
    	print("   Created Train_Arrival has occurence time " + train9b.GetTime()+ ", destination " + train9b.GetDestination() + ", train settings: " + train9b.GetTrain().returnDirection() + "/" + train9b.GetTrain().returnDepartTime() );
    	 
    	print("_______________________________________");
    	print("10. Verify that a Car_Arrival can be created"); 
    	print("\rCar_Arrival Class:\r   Creating Car_Arrival with occurence time 10, destination 2, origin 1, origin road 0 and Car from 5a.");
    	Car_Arrival carArrival10a = new Car_Arrival(new Car(3,0), 2, 1, 0, 10);
    	print("   Created Train_Arrival has occurence time " + carArrival10a.GetTime()+ ", destination " + carArrival10a.GetDestination() + ", origin  " + carArrival10a.GetOriginNeighborhood() + " Origin Road " + carArrival10a.GetOriginRoad() + "Car Settings: "+ carArrival10a.GetCar().GetDestination()  + "/" +  carArrival10a.GetCar().GetTotalTime());
    	print("\rCar_Arrival Class:\r   Creating Car_Arrival with occurence time 20, destination 0, origin 2, origin road 2 and Car from 5b.");
    	Car_Arrival carArrival10b = new Car_Arrival(new Car(0,-1), 0, 2, 2, 20);
    	print("   Created Train_Arrival has occurence time " + carArrival10b.GetTime()+ ", destination " + carArrival10b.GetDestination() + ", origin  " + carArrival10b.GetOriginNeighborhood() + " Origin Road " + carArrival10b.GetOriginRoad() + "Car Settings: "+ carArrival10b.GetCar().GetDestination()  + "/" +  carArrival10b.GetCar().GetTotalTime());
    	
    	print("_______________________________________");
    	print("11. Verify that a Car_Accident can be created"); 
    	print("\rCar_Accident Class:\r   Creating Car_Accident with occurence time -1, origin neigh 0, origin road 0 and isAccident true.");
    	Car_Accident carAccident11a = new Car_Accident(0, 0, -1, true);
    	print("   Created Train_Arrival has occurence time " + carAccident11a.GetTime()+ ", starting neigh" + carAccident11a.GetNeighborhood() + ", origin  road" + carAccident11a.GetRoad() + " isAccident set to  "+ carAccident11a.IsAccident());
    	print("\rCar_Accident Class:\r   Creating Car_Accident with occurence time 1000, origin neigh 3, origin road 2 and isAccident false.");
    	Car_Accident carAccident11b = new Car_Accident(3, 3, 1000, false);
    	print("   Created Train_Arrival has occurence time " + carAccident11b.GetTime()+ ", starting neigh" + carAccident11b.GetNeighborhood() + ", origin  road" + carAccident11b.GetRoad() + " isAccident set to  "+ carAccident11b.IsAccident());
    
    	print("_______________________________________");
    	print("12. Verify that Rain can be created"); 
    	print("\rRain Class:\r   Creating Rain with occurence time -1 and probability 0.");
    	Rain rain12a = new Rain(0);
    	print("   Created Rain has occurence time of " + rain12a.GetTime() + " and probability of " + rain12a.GetProb());
    	print("\rRain Class:\r   Creating Rain with occurence time -1 and probability 0.15.");
    	Rain rain12b = new Rain(.15);
    	print("   Created Rain has occurence time of " + rain12b.GetTime() + " and probability of " + rain12b.GetProb());
    	print("\rRain Class:\r   Creating Rain with occurence time -1 and probability 1.");
    	Rain rain12c = new Rain(1);
    	print("   Created Rain has occurence time of " + rain12c.GetTime() + " and probability of " + rain12c.GetProb());    	
   */ }
    
    // Function to build road
    private static void buildRoad()
    {/*
      	print("_______________________________________");
    	print("13. Verify that a Road can be created");
    	print("\r Road Class:\r Creating Road with max speed 65, 3 lanes, 30 miles long, 1.0 lane multiplier and an end neighorhood of 0");
    	print(" Expected Road Travel Time of __ and cars per minutes of 195");
    	Road road13a = new Road(65, 3, 30, 1.0, 0);
    	print("   Created Road has a end neighborhood of " + road13a.GetEndNeighborhood() + " travel time of " + road13a.GetTravelTime() + "  allows on " + road13a.GetCarsPerMin() + " cars per minute" );
    	print("\r Road Class:\r Creating Road with max speed 60, 2 lanes, 10 miles long, 1.66 lane multiplier and an end neighorhood of 3");
    	print(" Expected Road Travel Time of __ and cars per minutes of 199");
    	Road road13b = new Road(60, 2, 10, 1.66, 3);
    	print("   Created Road has a end neighborhood of " + road13b.GetEndNeighborhood() + " travel time of " + road13b.GetTravelTime() + "  allows on " + road13b.GetCarsPerMin() + " cars per minute" );
    */}
    
    // Function to build queues to run cars / travelers
    private static void buildQueue()
    {/*
     	print("_______________________________________");
    	print("14. Verify that a Queue can be created"); 
    	Queue<Car> queue14 = new ConcurrentLinkedQueue<Car>();
    	

       	print("_______________________________________");
    	print("15. Verify that a Queue can work with Cars"); 
    	print("   Enqueue Car from 5c with departure time 500 and destination 2");
    	queue14.add(new Car(2,500));
    	print("   Enqueue Car from 5b with departure time -1 and destination 0");
    	queue14.add(new Car(0,-1));
    	
    	print("Dequeueing first car");
    	Car tempCar = queue14.remove();
    	print("Dequeud Car has departure time " + tempCar.GetTotalTime() + " and destination " + tempCar.GetDestination());
    	print("Dequeueing second car");
    	tempCar = queue14.remove();
    	print("Dequeud Car has departure time " + tempCar.GetTotalTime() + " and destination " + tempCar.GetDestination());
    	
       	print("_______________________________________");
    	print("16. Verify that a Queue can work with Travelers"); 
    	Queue<Traveler> queue16 = new ConcurrentLinkedQueue<Traveler>();
      
    	print("   Enqueue Traveler from 4a with departure time 3 and destination 0");
    	queue16.add(new Traveler(0,3));
    	print("   Enqueue Car from 4b with departure time 179 and destination 1");
    	queue16.add(new Traveler(1,179));
    	
    	print("Dequeueing first traveler");
    	Traveler tempTraveler = queue16.remove();
    	print("Dequeud travler has departure time " + tempTraveler.GetTotalTime() + " and destination " + tempTraveler.GetDestination());
    	print("Dequeueing second traveler");
    	tempTraveler = queue16.remove();
    	print("Dequeud Traveler has departure time " + tempTraveler.GetTotalTime() + " and destination " + tempTraveler.GetDestination());
    */}
    
    // Build 2 neighborhoods
    private static void buildNeighborhood()
    {/*
    	print("_______________________________________");
    	print("17. Verify that a Neighborhood can be created.");
    	print("Building a Neighborhood ID 0 with road settings:");
    	print(" Road 0: Max Spd 65, Ln Size 2, Rd Length 10, Ln Mult 1, End Neigh 1 ");
    	print(" Road 1: Max Spd 0, Ln Size 0, Rd Length 0, Ln Mult 0, End Neigh 0 ");
    	print(" Road 2: Max Spd 65, Ln Size 3, Rd Length 30, Ln Mult 1, End Neigh 2");
    	print(" Road 3: Max Spd 65, Ln Size 2, Rd Length 20, Ln Mult 1, End Neigh 3 ");
    	print(" Road 4: Max Spd 0, Ln Size 0, Rd Length 0, Ln Mult 0, End Neigh 0 ");
    	Neighborhood neigh17a = new Neighborhood(
												new int[] { 65, 0, 65, 65, 0 }, 
												new int[] { 2, 0, 3, 2, 0 },
												new int[] { 10, 0, 30, 20, 0 }, 
												new double[] { 1.0, 0, 1.0,1.0, 0 }, 
												new int[] { 1, 0, 2, 3, 0 }, 0);
    	
    	
    	print("Building a Neighborhood ID 3 with road settings:");
    	print(" Road 0: Max Spd 65, Ln Size 2 Rd Length 20, Ln Mult 1.33, End Neigh 0 ");
    	print(" Road 1: Max Spd 0, Ln Size 0, Rd Length 0, Ln Mult 0, End Neigh 0  ");
    	print(" Road 2: Max Spd 0, Ln Size 0, Rd Length 0, Ln Mult 0, End Neigh 0");
    	print(" Road 3: Mx Spd 65, Ln Size 2, Rd Length 10, Ln Mult 1.66, End Neigh 2  ");
    	print(" Road 4: Max Spd 0, Ln Size 0, Rd Length 0, Ln Mult 0, End Neigh 0 ");
    	Neighborhood neigh17b = new Neighborhood(
												new int[] { 65, 0, 0, 65, 0 }, 
												new int[] { 2, 0, 0, 2, 0 },
												new int[] { 20, 0, 0, 10, 0 }, 
												new double[] { 1.33, 0, 0,1.66, 0 }, 
												new int[] { 0, 0, 0, 2, 0 }, 3);
    	
    	print("18. Verify that Neighborhoods contain 5 roads which were created.");
    	print("Checking Neighborhood 1's end neighborhoods: "
    			+ neigh17a.GetRoadEndNeigh(0) + "/" 
    			+ neigh17a.GetRoadEndNeigh(1) + "/"
    			+ neigh17a.GetRoadEndNeigh(2) + "/"
    			+ neigh17a.GetRoadEndNeigh(3) + "/"
    			+ neigh17a.GetRoadEndNeigh(4) + "/");
    	print("Checking Neighborhood 2's end neighborhoods: "
    			+ neigh17b.GetRoadEndNeigh(0) + "/" 
    			+ neigh17b.GetRoadEndNeigh(1) + "/"
    			+ neigh17b.GetRoadEndNeigh(2) + "/"
    			+ neigh17b.GetRoadEndNeigh(3) + "/"
    			+ neigh17b.GetRoadEndNeigh(4) + "/");
    	
    	print("19. Verify that Neighborhoods contain 8 queues.");
    	print("Check the debugging information up top.");
    	
   */ }
    
    // Build Average / Stats
    private static void CreateAverageStats()
    {/*
    	print("_______________________________________");
    	print("20. Verify that average can be created");
    	print("\r Average Struct\r Setting Total Speed = 60, Total Vehicles = 5, RouteDistance = 10");
    	Average avg20a = new Average();
    	avg20a.TotalSpeed = 60;
    	avg20a.TotalVehicles = 5;
    	avg20a.RouteDistance = 10;
    	print("     Created Average total speed is " + avg20a.TotalSpeed + " Total Vehicles is " + avg20a.TotalVehicles + " route Distance is " + avg20a.RouteDistance);
    	
    	print("_______________________________________");
    	print("21/23. Verify that Statics can be created and that it contains the proper arrays");
    	Statistics stat21a = new Statistics();
    	print("     Statistics Created Check Setting Road 0 / neigh 0 = 10, road 3 / neigh 2 = 20");
    	
    	if(true);
  	*/
    }
    
    // Build testSim
    private static void initTestSim()
    {
    	print("Creating new simulation");
    	testSim = new Simulation(100, new int[] { 5, 5, 5, 5 }, new int[][] {
			new int[] { 65, 0, 65, 65, 0 }, new int[] { 65, 65, 0, 65, 0 },
			new int[] { 65, 0, 65, 65, 65 }, new int[] { 65, 0, 0, 65, 0 } }, new int[][] {
			new int[] { 2, 0, 3, 2, 0 }, new int[] { 2, 1, 0, 2, 0 },
			new int[] { 2, 0, 3, 1, 2 }, new int[] { 2, 0, 0, 2, 0 } }, new int[][] {
			new int[] { 10, 0, 30, 20, 0 }, new int[] { 20, 20, 0, 10, 0 },
			new int[] { 10, 0, 30, 20, 20 }, new int[] { 20, 0, 0, 10, 0 } },
			new double[][] { new double[] { 1, 0, 1.66, 1.5, 0 },
					new double[] { 1.33, 1.66, 0, 1, 0 }, new double[] { 1, 0, 1.33, 1.66, 1.33 },
					new double[] { 1.5, 0, 0, 1, 0 } }, new int[][] {
					new int[] { 1, 0, 2, 3, 0 }, new int[] { 2, 2, 0, 0, 0 },
					new int[] { 3, 0, 0, 1, 1 }, new int[] { 0, 0, 0, 2, 0 } });
    	print("New simulation created successfully");
    }

    
    // Dan's Step 24 Stats
    private static void TestStatistics()
    {
    	//Testing simulation-statistics related methods
    	double testSpeed;
    	int numCars;
    	int numAccidents;
    	double vehiclesPerHr;
    	print("_______________________________________");
    	print("24. Testing Statistics/Simulation Methods");
    	initTestSim();
    	//Adds stat of car which travels from N0 to N1 on R0, takes 10 mins
    	testSim.SetStatistics(new Car_Arrival(new Car(1, 0), 1, 0, 0, 10));
    	//Adds stat of car which travels from N0 to N1 on R0, takes 10 mins
    	testSim.SetStatistics(new Car_Arrival(new Car(1, 5), 1, 0, 0, 15));
    	//Adds stat of car which travels from N0 to N1 on R0, takes 10 mins
    	testSim.SetStatistics(new Car_Arrival(new Car(1, 12), 1, 0, 0, 22));
    	//Adds stat of car which travels from N2 to N0 on R2, takes 10 mins
    	testSim.SetStatistics(new Car_Arrival(new Car(1, 302), 0, 2, 2, 322));
    	
    	//Adds a car accident from N0 to N1 on R0
    	testSim.SetStatistics(new Car_Accident(0, 0, 324, true));
    	//Turns off car accident from N0 to N1 on R0, should not affect stats
    	testSim.SetStatistics(new Car_Accident(0, 0, 345, false));
    	//Adds another car accident from N0 to N1 on R0
    	testSim.SetStatistics(new Car_Accident(0, 0, 336, true));
    	//Adds a car accident from N2 to N0 on R2
    	testSim.SetStatistics(new Car_Accident(2, 2, 17, true));
    	
    	//Adds rain to the simulation
    	testSim.SetStatistics(new Rain(0.5));
    	
    	//Print GetStatAvgSpeedPerRoute()
    	print("Average speed for N0-R0 should be: 60.0 mph");
    	print("Average speed for N0-R1 should be: 0.0 mph");
    	print("Average speed for N2-R2 should be: 90.0 mph");
    	testSpeed = testSim.GetStatAvgSpeedPerRoute(0, 0);
    	print("Average Speed for N0-R0: " + Double.toString(testSpeed) + " mph");
    	testSpeed = testSim.GetStatAvgSpeedPerRoute(0, 1);
    	print("Average Speed for N0-R1: " + Double.toString(testSpeed) + " mph");
    	testSpeed = testSim.GetStatAvgSpeedPerRoute(2, 2);
    	print("Average Speed for N2-R2: " + Double.toString(testSpeed) + " mph");
    	print("*		*		*");
    	//Test GetStatVehiclesPerRoute()
    	print("Number Cars for N0-R0 should be: 3");
    	print("Number Cars for N0-R1 should be: 0");
    	print("Number Cars for N2-R2 should be: 1");
    	numCars = testSim.GetStatVehiclesPerRoute(0, 0);
    	print("Number Cars for N0-R0: " + Integer.toString(numCars));
    	numCars = testSim.GetStatVehiclesPerRoute(0, 1);
    	print("Number Cars for N0-R1: " + Integer.toString(numCars));
    	numCars = testSim.GetStatVehiclesPerRoute(2, 2);
    	print("Number Cars for N2-R2: " + Integer.toString(numCars));
    	print("*		*		*");
    	//Tests GetStatNumAccidentsPerRoad() and GetStatTotalNumAccidents()
    	print("Number Accidents for N0-R0 should be: 2");
    	print("Number Accidents for N0-R1 should be: 0");
    	print("Number Accidents for N2-R2 should be: 1");
    	print("Total Number Accidents for Simulation should be: 3");
    	numAccidents = testSim.GetStatNumAccidentsPerRoad(0, 0);
    	print("Number Accidents for N0-R0: " + Integer.toString(numAccidents));
    	numAccidents = testSim.GetStatNumAccidentsPerRoad(0, 1);
    	print("Number Accidents for N0-R1: " + Integer.toString(numAccidents));
    	numAccidents = testSim.GetStatNumAccidentsPerRoad(2, 2);
    	print("Number Accidents for N2-R2: " + Integer.toString(numAccidents));
    	numAccidents = testSim.GetStatTotalNumAccidents();
    	print("Total Number of Accidents: " + Integer.toString(numAccidents));
    	print("*		*		*");
    	//Tests GetStatRainHistory
    	print("Should print that it rained.");
    	if (testSim.GetStatRainHistory())
    		print("Rain history shows RAIN.");
    	else
    		print("Rain history shows NO RAIN.");
    	print("*		*		*");
    	//Tests GetStatAvgVehiclesPerHour
    	print("Avg. Vehicles/Hour for N0-R0 should be: (3cars/120mins) = 1.5");
    	print("Avg. Vehicles/Hour for N0-R1 should be: (0cars/60mins) = 0.0");
    	print("Avg. Vehicles/Hour for N2-R2 should be: (1car/60mins) = 1.0");
    	vehiclesPerHr = testSim.GetStatAvgVehiclesPerHour(0, 0);
    	print("Avg. Vehicles/hr for N0-R0: " + Double.toString(vehiclesPerHr));
    	vehiclesPerHr = testSim.GetStatAvgVehiclesPerHour(0, 1);
    	print("Avg. Vehicles/hr for N0-R1: " + Double.toString(vehiclesPerHr));
    	vehiclesPerHr = testSim.GetStatAvgVehiclesPerHour(2, 2);
    	print("Avg. Vehicles/hr for N2-R2: " + Double.toString(vehiclesPerHr));
    	
    }
    
    private static void RunUseCases()
    {
    	print("_______________________________________");
    	print("Testing Use Cases");
    	initTestSim();
    	testSim.SetInitialConditions(.5, 0.85, 88, 9, new int[]{0,0,0,1,2,2,2,3,3}, new int[]{0,0,3,0,0,3,4,0,3}, new int[]{10,10,50,33,89,11,52,90,39});
    	print("SetInitialConditions:\rNo chance for rain\r30% of total traffic (24,000x5)\r0 trains\r0 accidents\r_______");

    	testSim.ProcessEvents();
    	int tempInt;
    	double tempDoub;
    	print("Average Trip Time Per Route In Minutes");
    	for (int i = 0; i < 4; i++)
    	{
    		for (int j = 0; j < 7; j++)
    		{
    			tempDoub = testSim.GetStatAverageTravelTimePerRoute(i, j);
    			print(Integer.toString(i) + "-" + Integer.toString(j) + ": " + Double.toString(tempDoub));
    		}
    	}
    	
    	print("Average Speed Per Route In");
    	for (int i = 0; i < 4; i++)
    	{
    		for (int j = 0; j < 7; j++)
    		{
    			tempDoub = testSim.GetStatAvgSpeedPerRoute(i, j);
    			print(Integer.toString(i) + "-" + Integer.toString(j) + ": " + Double.toString(tempDoub));
    		}
    	}
    	
    	print("Average Vehicles Per Hour Per Route");
    	for (int i = 0; i < 4; i++)
    	{
    		for (int j = 0; j < 7; j++)
    		{
    			tempDoub = testSim.GetStatAvgVehiclesPerHour(i, j);
    			print(Integer.toString(i) + "-" + Integer.toString(j) + ": " + Double.toString(tempDoub));
    		}
    	}
    	
    	print("Number Accidents Per Road");
    	
    	for (int i = 0; i < 4; i++)
    	{
    		for (int j = 0; j < 5; j++)
    		{
    			tempInt = testSim.GetStatNumAccidentsPerRoad(i, j);
    			print(Integer.toString(i) + "-" + Integer.toString(j) + ": " + Integer.toString(tempInt));
    		}
    	}
    	
    	print("Rain History");
    	
    	if (testSim.GetStatRainHistory())
    		print("It rained");
    	else
    		print("NO RAIN");
    	
    	print("Total Number of Accidents");
    	print(Integer.toString(testSim.GetStatTotalNumAccidents()));

    	
    	print("Number of Vehicles Per Route");
    	for (int i = 0; i < 4; i++)
    	{
    		for (int j = 0; j < 7; j++)
    		{
    			tempDoub = testSim.GetStatVehiclesPerRoute(i, j);
    			print(Integer.toString(i) + "-" + Integer.toString(j) + ": " + Double.toString(tempDoub));
    		}
    	}
    	
    	if(true);
    	/*
    	initTestSim();
    	testSim.SetInitialConditions(0.15, 0.6, 9, 1, new int[]{0}, new int[]{3}, new int[]{4});
    	print("SetInitialConditions:\r15% chance for rain\r60% of total traffic (48,000x5)\r9 trains\r1 accident\r_______");


    	initTestSim();
    	testSim.SetInitialConditions(1, 0.85, 55, 10, new int[]{0,0,0,1,2,2,2,2,3,3}, new int[]{0,2,3,0,0,2,3,4,0,3}, new int[]{1,100,50,33,89,220,11,52,90,39});
    	print("SetInitialConditions:\r100% chance for rain\r85% of total traffic (68,000x5)\r15 trains\r10 accidents\r_______");
    	if(true);

    	initTestSim();
    	testSim.PlaceEvent(new Rain(0.5));
    	print("Added 50% chance of rain");
    	testSim.PlaceEvent(new Car_Accident(0,2,15,true));
    	print("Added car accident event on highway from UC to Downtown at time 15.");
    	*/
  
    }
    
    
    
    private static void print(String line)
    {
    	System.out.println(line);
    }
    
}